/**
 * SaveMsgDataClient.java
 * Created at 2017-5-16
 * Created by xieshuang
 * Copyright (C) 2017 BROADTEXT SOFTWARE, All rights reserved.
 */
package ws.org.tempuri;

import java.util.List;

import ws.com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfstring;
import ws.org.datacontract.schemas._2004._07.ts.ResultInfo;

/**
 * <p>ClassName: SaveMsgDataClient</p>
 * <p>Description: 传送报文客户端</p>
 * <p>Author: xieshuang</p>
 * <p>Date: 2017-5-16</p>
 */
public class SaveMsgDataClient {
    
    /**
     * 唯一标识符
     */
    public static final String FLAG = "12588979D73B4A42BC6F751AE936628C";
    
    /**
     * 
     * <p>Description: 调用服务并返回结果</p>
     * @param dataList 报文信息
     * @return 结果集
     */
    public static String saveMsgData(List<String> dataList) {
        String resultInfo = "";
        try {
            ArrayOfstring msgData = new ArrayOfstring();
            for (int i = 0; i < dataList.size(); i++) {
                msgData.getString().add(dataList.get(i));
            }
            MessageService messageServie = new MessageService();
            IMessageService iService = messageServie.getBasicHttpBindingIMessageService();
            //解决jar冲突
            System.setProperty("javax.xml.bind.JAXBContext", "com.sun.xml.internal.bind.v2.ContextFactory");
            ResultInfo reInfo = iService.savaMsgData(FLAG, msgData);
            resultInfo = reInfo.getResultMsg();
        } catch (Exception e) {
            resultInfo = "调用失败！";
            e.printStackTrace();
        }
        return resultInfo;
    }
}
